<template>
  <div class="home">
    <div style="height:800px;width:100%">
      <uploadImg />
    </div>
    <form-b />

    <form-a />
    <form-self-component />

    <form-c />
    <form-d />
    <form-e />
    <form-f />
    <div style="height:50px;width:100%">

    </div>
    <img alt="Vue logo" src="../assets/logo.png">
    <HelloWorld msg="Welcome to Your Vue.js App" />
    <div>
      <h2>table的基本用法</h2>
      <a-table :columns="columns" :data-source="data">
        <span slot="customTitle"><a-icon type="smile-o" /> Namea</span>
        <a slot="name" slot-scope="text">{{ text }}+1</a>
        <span slot="tags" slot-scope="tags">
          <a-tag
            v-for="tag in tags"
            :key="tag"
            :color="tag === 'loser' ? 'volcano' : tag.length > 5 ? 'geekblue' : 'green'"
          >
            {{ tag.toUpperCase() }}
          </a-tag>
        </span>
        <span slot="action" slot-scope="text, record">
          <a>Invite 一 {{ record.name }}</a>
          <a-divider type="vertical" />
          <a>Delete</a>
          <a-divider type="vertical" />
          <a class="ant-dropdown-link"> More actions <a-icon type="down" /> </a>
        </span>

        <template slot="addressThead">
          <span style="color:blue;font-weight:700">我是地址头啊</span>
        </template>
        <template slot="addressTbody" slot-scope="value,scope,index">
          <!-- value：scope[key] key已经指定了 所以就能直接取出value了 -->
          <span style="color:yellow">{{ value }}-</span>
          <span style="color:blue">{{ scope.address }}+</span>
          <span style="color:blue">{{ index }}</span>
        </template>
      </a-table>
    </div>
    <table-two />
    <h2>筛选</h2> 
    <table-three />
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
import TableTwo from '@/components/TableTwo.vue'
import TableThree from '@/components/TableThree.vue'
import formA from '@/components/test/form01.vue'
import formB from '@/components/test/formB.vue'
import formC from '@/components/test/formC.vue'
import formD from '@/components/test/formD.vue'
import formE from '@/components/test/formE.vue'
import formF from '@/components/test/formF.vue'
import formSelfComponent from '@/components/test/formSelfComponent.vue'
import uploadImg from '@/components/test/upload.vue'
const columns = [
  {
    dataIndex: 'name',
    key: 'name',
    slots: { title: 'customTitle' },
    scopedSlots: { customRender: 'name' }
  },
  {
    title: 'Age',
    dataIndex: 'age',
    key: 'age'
  },
  {
    // //定义表头就不能写title了
    title: '地址',
    dataIndex: 'address',
    key: 'address',
    //定义表头
    slots: { title: 'addressThead' },
    //定义数据
    scopedSlots: {customRender: 'addressTbody'}
  },
  {
    title: 'Tags',
    key: 'tags',
    dataIndex: 'tags',
    scopedSlots: { customRender: 'tags' }
  },
  {
    title: 'Action',
    key: 'action',
    scopedSlots: { customRender: 'action' }
  }
]

const data = [
  {
    key: '1',
    name: 'John Brown',
    age: 32,
    address: 'New York No. 1 Lake Park',
    tags: ['nice', 'developer']
  },
  {
    key: '2',
    name: 'Jim Green',
    age: 42,
    address: 'London No. 1 Lake Park',
    tags: ['loser']
  },
  {
    key: '3',
    name: 'Joe Black',
    age: 32,
    address: 'Sidney No. 1 Lake Park',
    tags: ['cool', 'teacher']
  }
]

export default {
  name: 'Home',
  components: {
    HelloWorld,
    TableTwo,
    TableThree,
    uploadImg,
    formSelfComponent,
    formF,
    formE,
    formD,
    formC,
    formB,
    formA
  },
  data(){
    return {
      data,
      columns
    }
  }
}
</script>
